﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:w="http://schemas.jelle.druyts.net/2010/xaml/presentation"
             x:Class="Schedulr.Views.Controls.PictureDetails"
             d:DesignHeight="500"
             d:DesignWidth="500"
             mc:Ignorable="d">
    <UserControl.Resources>
        <w:EnumToBooleanConverter x:Key="enumConverter" />
    </UserControl.Resources>

    <DockPanel LastChildFill="True">
        <Border Style="{DynamicResource BorderStyle}" Background="Transparent" Padding="5" Margin="5" DockPanel.Dock="Bottom" Visibility="{Binding InfoMessageVisibility}">
            <TextBlock FontStyle="Italic" Foreground="{DynamicResource InfoFontBrush}" HorizontalAlignment="Right" Margin="0,0,10,0" Text="{Binding InfoMessage}" />
        </Border>
        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <StackPanel Margin="5">
                <Expander Header="Online" Margin="0,0,0,10" Visibility="{Binding OnlineDetailsVisibility}">
                    <StackPanel>
                        <Label Content="Web Page" />
                        <TextBlock><w:ExternalHyperlink Foreground="{DynamicResource InfoFontBrush}" NavigateUri="{Binding Path=Picture.WebUrl}" ToolTip="{Binding Path=Picture.WebUrl}"><Run Text="{Binding Path=Picture.Title}" /></w:ExternalHyperlink></TextBlock>
                        <Label Content="Date Uploaded" />
                        <TextBlock Foreground="{DynamicResource InfoFontBrush}" Text="{Binding Path=Picture.DateUploaded, StringFormat=f}" />
                    </StackPanel>
                </Expander>
                <Expander Header="Details" Margin="0,0,0,0">
                    <StackPanel>
                        <DockPanel Visibility="{Binding FileDetailsVisibility}" LastChildFill="True" >
                            <StackPanel DockPanel.Dock="Right" Margin="5,0,0,0">
                                <Label Content="_Size" Target="{Binding ElementName=fileSizeTextBox, Mode=OneWay}" />
                                <TextBox IsReadOnly="True" x:Name="fileSizeTextBox" Text="{Binding Path=FileSizeDescription, Mode=OneWay}">
                                    <TextBox.Style>
                                        <Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding FileSizeErrorVisibility}" Value="Visible">
                                                    <Setter Property="BorderBrush" Value="{DynamicResource ErrorForegroundBrush}" />
                                                    <Setter Property="Foreground" Value="{DynamicResource ErrorForegroundBrush}" />
                                                    <Setter Property="ToolTip" Value="The file is larger than the maximum file size you are allowed to upload." />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </TextBox.Style>
                                </TextBox>
                            </StackPanel>
                            <StackPanel>
                                <Label Content="_Path" Target="{Binding ElementName=fileNameTextBox, Mode=OneWay}" />
                                <TextBox IsReadOnly="True" x:Name="fileNameTextBox" Text="{Binding Path=Picture.FileName, Mode=OneWay}" />
                            </StackPanel>
                        </DockPanel>
                        <Label Content="_Title" Target="{Binding ElementName=titleTextBox, Mode=OneWay}" />
                        <TextBox x:Name="titleTextBox" Text="{Binding Path=Picture.Title, Mode=TwoWay}" IsReadOnly="{Binding IsReadOnly}" />
                        <Label Content="_Description" Target="{Binding ElementName=descriptionTextBox, Mode=OneWay}" />
                        <TextBox x:Name="descriptionTextBox" Text="{Binding Path=Picture.Description, Mode=TwoWay}" Height="100" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" IsReadOnly="{Binding IsReadOnly}" />
                        <Label Content="{Binding TagsLabel}" Target="{Binding ElementName=tagsTextBox, Mode=OneWay}" />
                        <TextBox x:Name="tagsTextBox" Text="{Binding Path=Picture.Tags, Mode=TwoWay}" IsReadOnly="{Binding IsReadOnly}" />
                    </StackPanel>
                </Expander>
                <Expander Header="Settings" Margin="0,10,0,0">
                    <WrapPanel>
                        <StackPanel Margin="0,0,20,0">
                            <Label Content="_Visibility" Target="{Binding ElementName=visibilityIsPublicCheckBox, Mode=OneWay}" />
                            <CheckBox x:Name="visibilityIsPublicCheckBox" Content="Public" IsChecked="{Binding Path=Picture.VisibilityIsPublic, Mode=TwoWay}" IsEnabled="{Binding IsEditable}" />
                            <CheckBox x:Name="visibilityIsFamilyCheckBox" Content="Family" IsChecked="{Binding Path=Picture.VisibilityIsFamily, Mode=TwoWay}" IsEnabled="{Binding IsEditable}" />
                            <CheckBox x:Name="visibilityIsFriendCheckBox" Content="Friends" IsChecked="{Binding Path=Picture.VisibilityIsFriend, Mode=TwoWay}" IsEnabled="{Binding IsEditable}" />
                        </StackPanel>
                        <StackPanel Margin="0,0,20,0">
                            <Label Content="_Safety" Target="{Binding ElementName=safetyIsNoneRadioButton, Mode=OneWay}" />
                            <RadioButton x:Name="safetyIsNoneRadioButton" GroupName="PhotoSafety" Content="Default" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=None}" IsEnabled="{Binding IsEditable}" />
                            <RadioButton x:Name="safetyIsSafeRadioButton" GroupName="PhotoSafety" Content="Safe" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Safe}" IsEnabled="{Binding IsEditable}" />
                            <RadioButton x:Name="safetyIsModerateRadioButton" GroupName="PhotoSafety" Content="Moderate" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Moderate}" IsEnabled="{Binding IsEditable}" />
                            <RadioButton x:Name="safetyIsRestrictedRadioButton" GroupName="PhotoSafety" Content="Restricted" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Restricted}" IsEnabled="{Binding IsEditable}" />
                        </StackPanel>
                        <StackPanel Margin="0,0,20,0">
                            <Label Content="Ty_pe" Target="{Binding ElementName=contentTypeIsNoneRadioButton, Mode=OneWay}" Foreground="{DynamicResource InputFontColor}" />
                            <RadioButton x:Name="contentTypeIsNoneRadioButton" GroupName="ContentType" Content="Default" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=None}" IsEnabled="{Binding IsEditable}" />
                            <RadioButton x:Name="contentTypeIsPhotoRadioButton" GroupName="ContentType" Content="Photo" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Photo}" IsEnabled="{Binding IsEditable}" />
                            <RadioButton x:Name="contentTypeIsScreenshotRadioButton" GroupName="ContentType" Content="Screenshot" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Screenshot}" IsEnabled="{Binding IsEditable}" />
                            <RadioButton x:Name="contentTypeIsOtherRadioButton" GroupName="ContentType" Content="Other" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Other}" IsEnabled="{Binding IsEditable}" />
                        </StackPanel>
                        <StackPanel Margin="0,0,20,0">
                            <Label Content="_License" Target="{Binding ElementName=licenseComboBox, Mode=OneWay}" Foreground="{DynamicResource InputFontColor}" />
                            <ComboBox x:Name="licenseComboBox" IsEnabled="{Binding IsEditable}">
                                <ComboBoxItem x:Name="licenseIsNoneRadioButton" Content="Default" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=None}" IsEnabled="{Binding IsEditable}" />
                                <ComboBoxItem x:Name="licenseIsAllRightsReservedRadioButton" Content="None (All rights reserved)" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AllRightsReserved}" IsEnabled="{Binding IsEditable}" />
                                <ComboBoxItem x:Name="licenseIsAttributionNoncommercialShareAlikeCC" Content="Attribution-NonCommercial-ShareAlike Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoncommercialShareAlikeCC}" IsEnabled="{Binding IsEditable}" />
                                <ComboBoxItem x:Name="licenseIsAttributionNoncommercialCC" Content="Attribution-NonCommercial Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoncommercialCC}" IsEnabled="{Binding IsEditable}" />
                                <ComboBoxItem x:Name="licenseIsAttributionNoncommercialNoDerivativesCC" Content="Attribution-NonCommercial-NoDerivs Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoncommercialNoDerivativesCC}" IsEnabled="{Binding IsEditable}" />
                                <ComboBoxItem x:Name="licenseIsAttributionCC" Content="Attribution Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionCC}" IsEnabled="{Binding IsEditable}" />
                                <ComboBoxItem x:Name="licenseIsAttributionShareAlikeCC" Content="Attribution-ShareAlike Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionShareAlikeCC}" IsEnabled="{Binding IsEditable}" />
                                <ComboBoxItem x:Name="licenseIsAttributionNoDerivativesCC" Content="Attribution-NoDerivs Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoDerivativesCC}" IsEnabled="{Binding IsEditable}" />
                            </ComboBox>
                        </StackPanel>
                    </WrapPanel>
                </Expander>
                <Expander Header="{Binding Path=Sets.Description}" Margin="0,10,0,0">
                    <ListBox ItemsSource="{Binding Path=Sets.Items}" Style="{StaticResource FlickrCollectionListStyle}" IsEnabled="{Binding IsEditable}" />
                </Expander>
                <Expander Header="{Binding Path=Groups.Description}" Margin="0,10,0,0">
                    <ListBox ItemsSource="{Binding Path=Groups.Items}" Style="{StaticResource FlickrCollectionListStyle}" IsEnabled="{Binding IsEditable}" />
                </Expander>
            </StackPanel>
        </ScrollViewer>
    </DockPanel>
</UserControl>